package com.example.mvvmrxjavaokhttpretrofit.model_test.activity;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;

import com.example.mvvmrxjavaokhttpretrofit.R;
import com.example.mvvmrxjavaokhttpretrofit.base.BaseActivity;
import com.example.mvvmrxjavaokhttpretrofit.model_test.viewmodel.TestViewModel;

public class MainActivity extends BaseActivity {

    public final String url = "calendar/vacations?";
    private TestViewModel testViewModel;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        FloatingActionButton fab = findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                testViewModel.getData(url,"");
            }
        });
        testViewModel = createViewModel(TestViewModel.class);
        registerViewModelObserver(testViewModel);
    }

    @Override
    public void onApiSuccessCallBack(int responCode, String responType, Object data) {
        super.onApiSuccessCallBack(responCode, responType, data);
        switch (responType){
            case url:

                break;
        }
    }

    @Override
    public void onApiErrorCallBack(int responCode, String responType, String message, Object data) {
        super.onApiErrorCallBack(responCode, responType, message, data);
    }
}
